
package API_Jung;

import edu.uci.ics.jung.visualization.VisualizationViewer;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.geom.Point2D;
import javax.swing.JMenuItem;
import javax.swing.JPopupMenu;
import pw.analyzer.Node;

public class MyMouseMenus {
    
    public static class EdgeMenu extends JPopupMenu implements java.io.Serializable{        
        // private JFrame frame; 
        public EdgeMenu() {
            super("Edge Menu");
        }
        
    }
    
    public static class VertexMenu extends JPopupMenu {
        public VertexMenu() {
            super("Vertex Menu");
            this.add(new ListEtapasItem("Lista de Etapas"));
            //this.addSeparator();
        }
    }

    public static class ListEtapasItem extends JMenuItem implements VertexMenuListener<Node>, MenuPointListener {
        Node vertex;
        VisualizationViewer visComp;
        Point2D point;


        @Override
        public void setVertexAndView(Node vertex, VisualizationViewer visComp) {
            this.vertex = vertex;
            this.visComp = visComp;
        }

        @Override
        public void setPoint(Point2D point) {
            this.point = point;
        }

        public  ListEtapasItem(String titulo) {            
            super(titulo);
            this.addActionListener(new ActionListener() {
                @Override
                public void actionPerformed(ActionEvent e) {

    //                Dimension dim = Toolkit.getDefaultToolkit().getScreenSize();
    //                // Determine the new location of the window
    //                int w = vertex.getToDoScreen().getSize().width;
    //                int h = vertex.getToDoScreen().getSize().height;
    //                int x = (dim.width-w)/2;
    //                int y = (dim.height-h)/2;
    //
    //                // Move the window
    //                if (vertex.getState() == 1 || vertex.getState() == 3) {
    //                    if (vertex.getType() == 2) {
    //                        vertex.getToDoScreen().setLocation(x, y);
    //                        vertex.getToDoScreen().setVisible(true); 
    //                    }
    //                }
                }

            });
        }
    }
   
}
    

